package thread.threaddemo;

/**
 * @Author: wenjingyuan
 * @Date: 2022/11/07/20:38
 * @Description:线程是否存活
 */
public class ThreadDemoByAlive {
    public static void main(String[] args) throws InterruptedException {
        Thread thread=new Thread(()->{
            System.out.println("线程是否存活2"+Thread.currentThread().isAlive());
        });
        System.out.println("线程是否存活"+thread.isAlive());
        thread.start();
        System.out.println("线程是否存活3"+thread.isAlive());
        Thread.sleep(1000);
        System.out.println("线程是否存活4"+thread.isAlive());
    }
}
